/*
 * create:2016年1月11日 下午10:37:23
 * author:wangds  
 */
package net.wangds.common.composite.test;

import static org.junit.Assert.*;
import net.wangds.common.Component;
import net.wangds.common.composite.AbstractLinkedListComposite;

import org.junit.Test;

/**
 * .
 * @author wangds
 *
 */
public class CompositeTestCase {

  @Test
  public void test() {
    //fail("Not yet implemented");
    AbstractLinkedListComposite<B> c =new AbstractLinkedListComposite<B>() {
    };
    assertNotNull(c);
    B s = new B();
    c.add(s);
    assertNotNull(c.listAllComponent());
    assertEquals(1,c.listAllComponent().size());
    c.remove(s);
    assertEquals(0,c.listAllComponent().size());
    c.add(s);
    assertEquals(s,c.getComponent(0));
    c.clear();
    assertEquals(0,c.listAllComponent().size());
    c.add(s);
    B s1 = new B();
    c.add(s1);
    assertEquals(2,c.listAllComponent().size());
    c.remove(0);
    assertEquals(1,c.listAllComponent().size());
    
  }

}

class B implements Component{}
